import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;


public class DeckTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testShuffleCards() {
		Deck d = new Deck();
		int [] how_many_times_appears = new int [52];
		boolean flag_isok;
		for (int i=0; i<1000000; i++)
		{
			int [] card_ids = d.printDeckIds();
			d.shuffleCards();
			for (int j=0; j<52; j++)
			{
				how_many_times_appears[j] = 0;
			}
			for (int j=0; j<52; j++)
			{
				how_many_times_appears[card_ids[j]-1]++;
			}
			flag_isok = true;
			for (int j=0; j<52; j++)
			{
				if (how_many_times_appears[j]!=1) flag_isok = false;
			}
			assertEquals("Karta zduplikowana lub sie nie pojawila",flag_isok, true);
		}
		//fail("Not yet implemented");
	}

}
